package com.itluma.myproject.shiro.realm;

import com.itluma.myproject.shiro.token.MyToken;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.subject.PrincipalCollection;

/**
 * @author 飞鸟
 * @create 2021-06-15 9:32
 */
public class ShiroRealm extends AuthorizingRealm {
    @Override
    protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
        return null;
    }

    @Override
    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
        //校验验证码
        if(token instanceof MyToken){
            MyToken myToken = (MyToken) token;
            String inputCode = myToken.getCode();
            //1、和Session中的验证码进行比对

            //2、比对用户信息了
        }

        return null;
    }
}
